.class public Lcom/glympse/platform/common/LocManagerBase;
.super Ljava/lang/Object;
.source "LocManagerBase.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/glympse/platform/common/LocManagerBase$AddLocationOnMainThread;
    }
.end annotation


# instance fields
.field private m_lLastGpsTime:J

.field public m_oLastLocPoint:Lcom/glympse/platform/common/LocPoint;


# direct methods
.method public constructor <init>()V
    .locals 2

    .prologue
    .line 17
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 19
    const-wide/16 v0, 0x0

    iput-wide v0, p0, Lcom/glympse/platform/common/LocManagerBase;->m_lLastGpsTime:J

    .line 20
    new-instance v0, Lcom/glympse/platform/common/LocPoint;

    invoke-direct {v0}, Lcom/glympse/platform/common/LocPoint;-><init>()V

    iput-object v0, p0, Lcom/glympse/platform/common/LocManagerBase;->m_oLastLocPoint:Lcom/glympse/platform/common/LocPoint;

    .line 17
    return-void
.end method


# virtual methods
.method public AddLocation(Lcom/glympse/platform/common/LocPoint;)V
    .locals 1
    .parameter "oLocPoint"

    .prologue
    .line 25
    const/4 v0, 0x0

    invoke-virtual {p0, p1, v0}, Lcom/glympse/platform/common/LocManagerBase;->AddLocation(Lcom/glympse/platform/common/LocPoint;Z)V

    .line 26
    return-void
.end method

.method protected AddLocation(Lcom/glympse/platform/common/LocPoint;Z)V
    .locals 5
    .parameter "oLocPoint"
    .parameter "fFromPost"

    .prologue
    .line 32
    invoke-virtual {p1}, Lcom/glympse/platform/common/LocPoint;->HasLocation()Z

    move-result v3

    if-nez v3, :cond_1

    .line 83
    :cond_0
    :goto_0
    return-void

    .line 37
    :cond_1
    if-nez p2, :cond_2

    const/4 v3, 0x1

    iget v4, p1, Lcom/glympse/platform/common/LocPoint;->m_eLocProvider:I

    if-ne v3, v4, :cond_2

    .line 40
    iget-wide v1, p1, Lcom/glympse/platform/common/LocPoint;->m_lLocationTime:J

    .line 41
    .local v1, lGpsTime:J
    const-wide/16 v3, 0x0

    cmp-long v3, v1, v3

    if-lez v3, :cond_0

    iget-wide v3, p0, Lcom/glympse/platform/common/LocManagerBase;->m_lLastGpsTime:J

    cmp-long v3, v1, v3

    if-eqz v3, :cond_0

    .line 47
    invoke-static {v1, v2}, Lcom/glympse/platform/common/CorrectedTime;->SetGpsTime(J)V

    .line 48
    iput-wide v1, p0, Lcom/glympse/platform/common/LocManagerBase;->m_lLastGpsTime:J

    .line 52
    .end local v1           #lGpsTime:J
    :cond_2
    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v3

    invoke-virtual {v3}, Lcom/glympse/platform/Platform;->IsMainThread()Z

    move-result v3

    if-nez v3, :cond_4

    .line 54
    if-eqz p2, :cond_3

    .line 56
    const-string v3, "PROBLEM - AddLocation passed to main thread, but still not on main thread."

    invoke-static {v3}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/String;)V

    .line 58
    :cond_3
    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v3

    new-instance v4, Lcom/glympse/platform/common/LocManagerBase$AddLocationOnMainThread;

    invoke-direct {v4, p0, p1}, Lcom/glympse/platform/common/LocManagerBase$AddLocationOnMainThread;-><init>(Lcom/glympse/platform/common/LocManagerBase;Lcom/glympse/platform/common/LocPoint;)V

    invoke-virtual {v3, v4}, Lcom/glympse/platform/Platform;->PostToMainThread(Lcom/glympse/platform/GRunnable;)Z

    goto :goto_0

    .line 66
    :cond_4
    invoke-virtual {p1}, Lcom/glympse/platform/common/LocPoint;->HasSpeed()Z

    move-result v3

    if-eqz v3, :cond_5

    iget v3, p1, Lcom/glympse/platform/common/LocPoint;->m_fltSpeedMetersPerSecond:F

    const/high16 v4, 0x42c8

    cmpl-float v3, v3, v4

    if-lez v3, :cond_5

    .line 68
    const/high16 v3, 0x7fc0

    iput v3, p1, Lcom/glympse/platform/common/LocPoint;->m_fltSpeedMetersPerSecond:F

    .line 72
    :cond_5
    iput-object p1, p0, Lcom/glympse/platform/common/LocManagerBase;->m_oLastLocPoint:Lcom/glympse/platform/common/LocPoint;

    .line 75
    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v3

    iget-object v3, v3, Lcom/glympse/platform/Platform;->m_oServerPost:Lcom/glympse/platform/common/ServerPost;

    iget-object v4, p0, Lcom/glympse/platform/common/LocManagerBase;->m_oLastLocPoint:Lcom/glympse/platform/common/LocPoint;

    invoke-virtual {v3, v4}, Lcom/glympse/platform/common/ServerPost;->NewLocation(Lcom/glympse/platform/common/LocPoint;)V

    .line 79
    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v3

    iget-object v3, v3, Lcom/glympse/platform/Platform;->m_oSentTickets:Lcom/glympse/platform/common/SentTicketList;

    iget-object v4, p0, Lcom/glympse/platform/common/LocManagerBase;->m_oLastLocPoint:Lcom/glympse/platform/common/LocPoint;

    invoke-virtual {v3, v4}, Lcom/glympse/platform/common/SentTicketList;->ProcessExpireOnArrival(Lcom/glympse/platform/common/LocPoint;)Z

    move-result v0

    .line 82
    .local v0, fArrived:Z
    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v3

    if-eqz v0, :cond_6

    const v4, 0x8000

    :goto_1
    or-int/lit16 v4, v4, 0x200

    invoke-virtual {v3, v4}, Lcom/glympse/platform/Platform;->DoUpdate(I)V

    goto :goto_0

    :cond_6
    const/4 v4, 0x0

    goto :goto_1
.end method
